<?php

namespace App\Http\Controllers\Backend\Api\V1;

use App\Http\Requests\Backend\ImageUploadRequest;

class UploadController extends BaseController
{
    public function imageUpload(ImageUploadRequest $request)
    {
        $file = $request->filldata();
        $data = save_image($file);
        return ['location' => $data['url'], 'path' => $data['path']];
    }

    public function assumeRole()
    {
        $res = aliyun_assumeRole();

        if (!$res) {
            return $this->error('AssumeRole错误');
        }

        return $this->successData(compact('res'));
    }
}
